..
/
download
<?xml version='1.0'?>
<!--beaslic, 01/05/2011, changed stylesheet version to 1.1-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version='1.1'>
<!-- ********************************************************************
$Id: formal.xsl,v 1.28 2003/01/22 14:07:27 nwalsh Exp $
********************************************************************
This file is part of the XSL DocBook Stylesheet distribution.
See ../README or http://nwalsh.com/docbook/xsl/ for copyright
and other information.
******************************************************************** -->
<!-- 8/19/11 - KR - added dmc to ids to make them unique in pubs -->
<xsl:param name="stylesheet.result.type" select="'fo'"/>
<xsl:param name="use.extensions" select="'0'"/>
<xsl:param name="xep.extensions" select="0"/>
<xsl:param name="formal.title.placement">
table before
</xsl:param>
<xsl:attribute-set name="formal.object.properties">
<xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
<xsl:attribute name="space-before.maximum">2em</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.5em</xsl:attribute>
<xsl:attribute name="space-after.optimum">1em</xsl:attribute>
<xsl:attribute name="space-after.maximum">2em</xsl:attribute>
<!-- <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
--></xsl:attribute-set>
<xsl:attribute-set name="equation.properties" use-attribute-sets="formal.object.properties"/>
<xsl:attribute-set name="example.properties" use-attribute-sets="formal.object.properties"/>
<xsl:attribute-set name="procedure.properties" use-attribute-sets="formal.object.properties"/>
<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:value-of select="$body.font.master"/>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
<xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
<xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="normal.para.spacing">
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
<xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="body.font.master">10</xsl:param>
<xsl:param name="default.table.width" select="''"/>
<xsl:param name="table.cell.border.color" select="'black'"/>
<xsl:param name="table.cell.border.style" select="'solid'"/>
<xsl:param name="table.cell.border.thickness" select="'0.5pt'"/>
<xsl:attribute-set name="table.cell.padding">
<xsl:attribute name="padding-left">2pt</xsl:attribute>
<xsl:attribute name="padding-right">2pt</xsl:attribute>
<xsl:attribute name="padding-top">2pt</xsl:attribute>
<xsl:attribute name="padding-bottom">2pt</xsl:attribute>
<xsl:attribute name="start-indent">2pt</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="table.footnote.number.format" select="'a'"/>
<xsl:param name="table.footnote.number.symbols" select="''"/>
<xsl:param name="table.frame.border.color" select="'black'"/>
<xsl:param name="table.frame.border.style" select="'solid'"/>
<xsl:param name="table.frame.border.thickness" select="'0.5pt'"/>
<xsl:attribute-set name="table.properties" use-attribute-sets="formal.object.properties"/>
<xsl:param name="tablecolumns.extension" select="'1'"/>
<xsl:template name="object.id">
<xsl:param name="object" select="."/>
<xsl:choose>
<xsl:when test="$object/@id">
<!-- 8/19/11 - KR - added dmc to ids to make them unique in pubs -->
<xsl:apply-templates select="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode"/>
<xsl:value-of select="$object/@id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id($object)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="pi-attribute">
<xsl:param name="pis" select="processing-instruction('dbfo')"/>
<xsl:param name="attribute">filename</xsl:param>
<xsl:param name="count">1</xsl:param>
<xsl:choose>
<xsl:when test="$count>count($pis)">
<!-- not found -->
</xsl:when>
<xsl:otherwise>
<xsl:variable name="pi">
<xsl:value-of select="$pis[$count]"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($pi,concat($attribute, '='))">
<xsl:variable name="rest" select="substring-after($pi,concat($attribute,'='))"/>
<xsl:variable name="quote" select="substring($rest,1,1)"/>
<xsl:value-of select="substring-before(substring($rest,2),$quote)"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$pis"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="count" select="$count + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="copy-string">
<!-- returns 'count' copies of 'string' -->
<xsl:param name="string"/>
<xsl:param name="count" select="0"/>
<xsl:param name="result"/>
<xsl:choose>
<xsl:when test="$count>0">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="count" select="$count - 1"/>
<xsl:with-param name="result">
<xsl:value-of select="$result"/>
<xsl:value-of select="$string"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="anchor">
<xsl:param name="node" select="."/>
<xsl:param name="conditional" select="1"/>
<xsl:variable name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$conditional = 0 or $node/@id">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="formal.object">
<xsl:param name="placement" select="'before'"/>
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="content">
<xsl:if test="$placement = 'before'">
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
<xsl:if test="$placement != 'before'">
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(.) = 'example'">
<fo:block id="{$id}"
xsl:use-attribute-sets="example.properties">
<xsl:copy-of select="$content"/>
</fo:block>
</xsl:when>
<xsl:when test="local-name(.) = 'equation'">
<fo:block id="{$id}"
xsl:use-attribute-sets="equation.properties">
<xsl:copy-of select="$content"/>
</fo:block>
</xsl:when>
<xsl:when test="local-name(.) = 'table'">
<fo:block id="{$id}"
xsl:use-attribute-sets="table.properties">
<xsl:copy-of select="$content"/>
</fo:block>
</xsl:when>
<xsl:when test="local-name(.) = 'procedure'">
<fo:block id="{$id}"
xsl:use-attribute-sets="procedure.properties">
<xsl:copy-of select="$content"/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block id="{$id}"
xsl:use-attribute-sets="formal.object.properties">
<xsl:copy-of select="$content"/>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="formal.object.heading">
<xsl:param name="object" select="title"/>
<xsl:param name="placement" select="'before'"/>
<fo:block xsl:use-attribute-sets="formal.title.properties">
<xsl:choose>
<xsl:when test="$placement = 'before'">
<xsl:attribute
name="keep-with-next.within-column">always</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute
name="keep-with-previous.within-column">always</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="$object" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</fo:block>
</xsl:template>
<xsl:template name="table.frame">
<xsl:variable name="frame">
<xsl:choose>
<xsl:when test="@frame">
<xsl:value-of select="@frame"/>
</xsl:when>
<xsl:when test="ancestor::table/@frame">
<xsl:value-of select="ancestor::table/@frame"/>
</xsl:when>
<xsl:otherwise>all</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$frame='all'">
<xsl:attribute name="border-left-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-right-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-top-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-left-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-right-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-top-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-left-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
<xsl:attribute name="border-right-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
<xsl:attribute name="border-top-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$frame='bottom'">
<xsl:attribute name="border-left-style">none</xsl:attribute>
<xsl:attribute name="border-right-style">none</xsl:attribute>
<xsl:attribute name="border-top-style">none</xsl:attribute>
<xsl:attribute name="border-bottom-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$frame='sides'">
<xsl:attribute name="border-left-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-right-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-top-style">none</xsl:attribute>
<xsl:attribute name="border-bottom-style">none</xsl:attribute>
<xsl:attribute name="border-left-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-right-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-left-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
<xsl:attribute name="border-right-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$frame='top'">
<xsl:attribute name="border-left-style">none</xsl:attribute>
<xsl:attribute name="border-right-style">none</xsl:attribute>
<xsl:attribute name="border-top-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-style">none</xsl:attribute>
<xsl:attribute name="border-top-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-top-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$frame='topbot'">
<xsl:attribute name="border-left-style">none</xsl:attribute>
<xsl:attribute name="border-right-style">none</xsl:attribute>
<xsl:attribute name="border-top-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-style">
<xsl:value-of select="$table.frame.border.style"/>
</xsl:attribute>
<xsl:attribute name="border-top-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-width">
<xsl:value-of select="$table.frame.border.thickness"/>
</xsl:attribute>
<xsl:attribute name="border-top-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
<xsl:attribute name="border-bottom-color">
<xsl:value-of select="$table.frame.border.color"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$frame='none'">
<xsl:attribute name="border-left-style">none</xsl:attribute>
<xsl:attribute name="border-right-style">none</xsl:attribute>
<xsl:attribute name="border-top-style">none</xsl:attribute>
<xsl:attribute name="border-bottom-style">none</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Impossible frame on table: </xsl:text>
<xsl:value-of select="$frame"/>
</xsl:message>
<xsl:attribute name="border-left-style">none</xsl:attribute>
<xsl:attribute name="border-right-style">none</xsl:attribute>
<xsl:attribute name="border-top-style">none</xsl:attribute>
<xsl:attribute name="border-bottom-style">none</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="table.content">
<fo:block id="{$id}"
xsl:use-attribute-sets="formal.object.properties"
space-before.conditionality="retain"
space-after.conditionality="retain"
space-after="12pt"
start-indent="0pt">
<xsl:if test="$placement = 'before'">
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:if>
<xsl:for-each select="tgroup">
<xsl:variable name="prop-columns"
select=".//colspec[contains(@colwidth, '*')]"/>
<fo:table border-collapse="collapse" table-omit-footer-at-break="false">
<!-- <xsl:call-template name="table.frame"/>
--><!-- <xsl:if test="following-sibling::tgroup">
<xsl:attribute name="border-bottom-width">0pt</xsl:attribute>
<xsl:attribute name="border-bottom-style">none</xsl:attribute>
<xsl:attribute name="padding-bottom">0pt</xsl:attribute>
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
<xsl:attribute name="space-after">0pt</xsl:attribute>
<xsl:attribute name="space-after.minimum">0pt</xsl:attribute>
<xsl:attribute name="space-after.optimum">0pt</xsl:attribute>
<xsl:attribute name="space-after.maximum">0pt</xsl:attribute>
</xsl:if>
<xsl:if test="preceding-sibling::tgroup">
<xsl:attribute name="border-top-width">0pt</xsl:attribute>
<xsl:attribute name="border-top-style">none</xsl:attribute>
<xsl:attribute name="padding-top">0pt</xsl:attribute>
<xsl:attribute name="margin-top">0pt</xsl:attribute>
<xsl:attribute name="space-before">0pt</xsl:attribute>
<xsl:attribute name="space-before.minimum">0pt</xsl:attribute>
<xsl:attribute name="space-before.optimum">0pt</xsl:attribute>
<xsl:attribute name="space-before.maximum">0pt</xsl:attribute>
</xsl:if>
--> <xsl:if test="count($prop-columns) != 0">
<xsl:attribute name="table-layout">fixed</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="."/>
</fo:table>
</xsl:for-each>
<xsl:if test="$placement != 'before'">
<xsl:call-template name="formal.object.heading">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:if>
</fo:block>
</xsl:variable>
<xsl:variable name="footnotes">
<xsl:if test="tgroup//footnote">
<fo:block
keep-with-previous="always">
<xsl:apply-templates select="tgroup//footnote" mode="table.footnote.mode"/>
</fo:block>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@orient='land'">
<fo:block-container reference-orientation="90">
<fo:block>
<xsl:attribute name="span">
<xsl:choose>
<xsl:when test="@pgwide=1">all</xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:copy-of select="$table.content"/>
<xsl:copy-of select="$footnotes"/>
</fo:block>
</fo:block-container>
</xsl:when>
<xsl:otherwise>
<fo:block>
<xsl:attribute name="span">
<xsl:choose>
<xsl:when test="@pgwide=1">all</xsl:when>
<xsl:otherwise>none</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:copy-of select="$table.content"/>
<!--
<xsl:copy-of select="$footnotes"/-->
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="number-tables">
<xsl:variable name="countTables">
<xsl:value-of select="count(preceding::table)"/>
</xsl:variable>
<xsl:variable name="countRef">1</xsl:variable>
<xsl:variable name="countreqCondTables">
<xsl:value-of select="count(preceding::reqCondGroup|preceding::reqSupportEquips|preceding::reqSupplies|preceding::reqSpares|preceding::reqPersons|preceding::reqTechInfoGroup)"/>
</xsl:variable>
<xsl:variable name="countmaintPlanningTables">
<xsl:value-of select="count(preceding::maintAllocation|preceding::toolsList|preceding::remarksList)"/>
</xsl:variable>
<xsl:variable name="countfaultTables">
<xsl:value-of select="count(preceding::repair|preceding::faultIsolationRef|preceding::testDescr|preceding::testProcedure)"/>
</xsl:variable>
<xsl:variable name="countSelf">
<xsl:value-of select="count(ancestor-or-self::table|ancestor-or-self::reqCondGroup|ancestor-or-self::reqSupportEquips|ancestor-or-self::reqSupplies|
ancestor-or-self::reqSpares|ancestor-or-self::reqPersons|ancestor-or-self::reqTechInfoGroup|
ancestor-or-self::maintAllocation|ancestor-or-self::toolsList|ancestor-or-self::remarksList|ancestor-or-self::repair|
ancestor-or-self::faultIsolationRef|ancestor-or-self::testDescr|ancestor-or-self::testProcedure)"/>
</xsl:variable>
<xsl:value-of select="$countTables+$countRef+$countSelf+$countreqCondTables+$countmaintPlanningTables+$countfaultTables"/>
</xsl:template>
<xsl:template match="table/title" mode="object.title.markup">
<fo:block font-weight="bold"
line-height="12pt"
text-align="center"
space-before.optimum="11pt"
space-after.optimum="11pt"
space-after.conditionality="retain"
space-after.precedence="1"
keep-with-next="always">
<xsl:text>Table </xsl:text>
<xsl:call-template name="number-tables"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:if test="parent::table/@changeMark='1'">
<fo:change-bar-begin change-bar-style="solid" change-bar-color="black"
change-bar-offset="8pt" change-bar-placement="left"/>
<fo:change-bar-end/>
</xsl:if>
</fo:block>
</xsl:template>
</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c)1998-2003 Copyright Sonic Software Corporation. All rights reserved.
<metaInformation>
<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
</metaInformation>
-->
gopher://khzae.net/0/s1000d/links/projects/3031/Army S1000D Stylesheets/FO-3031-A00-USARMY-DOCBOOK-FORMAL_001-00_EN-US.xsl